package com.inno.sms.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum SmsTypeEnum {
    //短信类型 0-登录注册短信 1-日程提醒 2-系统通知
    LOGIN_REGISTER("0", "登录注册短信"),
    SCHEDULE_REMIND("1", "日程提醒"),
    SYSTEM_NOTICE("2", "系统通知");

    private final String code;
    private final String desc;

    SmsTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDesc(String code) {
        return Arrays.stream(SmsTypeEnum.values())
                .filter(item -> item.getCode().equals(code))
                .findFirst()
                .map(SmsTypeEnum::getDesc)
                .orElse("");

    }
}
